<?php
define("INWEB",true);
require('include/config.php');
loggedInOrReturn('index.php');
function delFile($fn)
{
    unlink('files/'.$fn);
}
try
{
$fn=getVar('id');
if($_GET['del'])
{
    ignore_user_abort(false);
    //register_shutdown_function('delFile',$fn);
}
switch(end(explode('.',$fn)))
{
    case 'xml':
    case 'xls':
    header('Content-type: application/ms-excel');
    header('Content-Disposition: attachment; filename='.$fn);
    break;
}
    ob_clean();
    flush();
    readfile('files/'.$fn);
}
catch(Exception $e)
{
    msg($Lang['error'],'Something went wrong','error');
    exit;
}
?>